<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: Spec::Rails::Example::RenderObserver</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">Spec::Rails::Example::RenderObserver</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../../files/vendor/plugins/rspec-rails/lib/spec/rails/example/render_observer_rb.html">
                vendor/plugins/rspec-rails/lib/spec/rails/example/render_observer.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Extends the <a href="RenderObserver.html#M000025">should_receive</a>, <a
href="RenderObserver.html#M000026">should_not_receive</a> and stub! methods
in rspec&#8216;s mocking framework to handle render calls to controller in
controller examples and template and view examples
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000022">expect_render</a>&nbsp;&nbsp;
      <a href="#M000026">should_not_receive</a>&nbsp;&nbsp;
      <a href="#M000025">should_receive</a>&nbsp;&nbsp;
      <a href="#M000027">stub!</a>&nbsp;&nbsp;
      <a href="#M000023">stub_render</a>&nbsp;&nbsp;
      <a href="#M000024">warn_deprecation</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000022" class="method-detail">
        <a name="M000022"></a>

        <div class="method-heading">
          <a href="#M000022" class="method-signature">
          <span class="method-name">expect_render</span><span class="method-args">(opts={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
DEPRECATED
</p>
<p>
Use <a
href="RenderObserver.html#M000025">should_receive</a>(:render).with(opts)
instead
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000022-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec-rails/lib/spec/rails/example/render_observer.rb, line 14</span>
14:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expect_render</span>(<span class="ruby-identifier">opts</span>={})
15:           <span class="ruby-identifier">warn_deprecation</span>(<span class="ruby-value str">&quot;expect_render&quot;</span>, <span class="ruby-value str">&quot;should_receive&quot;</span>)
16:           <span class="ruby-identifier">register_verify_after_each</span>
17:           <span class="ruby-identifier">render_proxy</span>.<span class="ruby-identifier">should_receive</span>(<span class="ruby-identifier">:render</span>, <span class="ruby-identifier">:expected_from</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">caller</span>(<span class="ruby-value">1</span>)[<span class="ruby-value">0</span>]).<span class="ruby-identifier">with</span>(<span class="ruby-identifier">opts</span>)
18:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000026" class="method-detail">
        <a name="M000026"></a>

        <div class="method-heading">
          <a href="#M000026" class="method-signature">
          <span class="method-name">should_not_receive</span><span class="method-args">(*args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000026-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec-rails/lib/spec/rails/example/render_observer.rb, line 56</span>
56:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">should_not_receive</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
57:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">:render</span>
58:             <span class="ruby-identifier">register_verify_after_each</span>
59:             <span class="ruby-identifier">render_proxy</span>.<span class="ruby-identifier">should_not_receive</span>(<span class="ruby-identifier">:render</span>)
60:           <span class="ruby-keyword kw">else</span>
61:             <span class="ruby-keyword kw">super</span>
62:           <span class="ruby-keyword kw">end</span>
63:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000025" class="method-detail">
        <a name="M000025"></a>

        <div class="method-heading">
          <a href="#M000025" class="method-signature">
          <span class="method-name">should_receive</span><span class="method-args">(*args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000025-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec-rails/lib/spec/rails/example/render_observer.rb, line 47</span>
47:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">should_receive</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
48:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">:render</span>
49:             <span class="ruby-identifier">register_verify_after_each</span>
50:             <span class="ruby-identifier">render_proxy</span>.<span class="ruby-identifier">should_receive</span>(<span class="ruby-identifier">:render</span>, <span class="ruby-identifier">:expected_from</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">caller</span>(<span class="ruby-value">1</span>)[<span class="ruby-value">0</span>])
51:           <span class="ruby-keyword kw">else</span>
52:             <span class="ruby-keyword kw">super</span>
53:           <span class="ruby-keyword kw">end</span>
54:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000027" class="method-detail">
        <a name="M000027"></a>

        <div class="method-heading">
          <a href="#M000027" class="method-signature">
          <span class="method-name">stub!</span><span class="method-args">(*args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000027-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec-rails/lib/spec/rails/example/render_observer.rb, line 65</span>
65:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stub!</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
66:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">:render</span>
67:             <span class="ruby-identifier">register_verify_after_each</span>
68:             <span class="ruby-identifier">render_proxy</span>.<span class="ruby-identifier">stub!</span>(<span class="ruby-identifier">:render</span>, <span class="ruby-identifier">:expected_from</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">caller</span>(<span class="ruby-value">1</span>)[<span class="ruby-value">0</span>])
69:           <span class="ruby-keyword kw">else</span>
70:             <span class="ruby-keyword kw">super</span>
71:           <span class="ruby-keyword kw">end</span>
72:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000023" class="method-detail">
        <a name="M000023"></a>

        <div class="method-heading">
          <a href="#M000023" class="method-signature">
          <span class="method-name">stub_render</span><span class="method-args">(opts={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
DEPRECATED
</p>
<p>
Use <a href="RenderObserver.html#M000027">stub!</a>(:render).with(opts)
instead
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000023-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec-rails/lib/spec/rails/example/render_observer.rb, line 23</span>
23:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stub_render</span>(<span class="ruby-identifier">opts</span>={})
24:           <span class="ruby-identifier">warn_deprecation</span>(<span class="ruby-value str">&quot;stub_render&quot;</span>, <span class="ruby-value str">&quot;stub!&quot;</span>)
25:           <span class="ruby-identifier">register_verify_after_each</span>
26:           <span class="ruby-identifier">render_proxy</span>.<span class="ruby-identifier">stub!</span>(<span class="ruby-identifier">:render</span>, <span class="ruby-identifier">:expected_from</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">caller</span>(<span class="ruby-value">1</span>)[<span class="ruby-value">0</span>]).<span class="ruby-identifier">with</span>(<span class="ruby-identifier">opts</span>)
27:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000024" class="method-detail">
        <a name="M000024"></a>

        <div class="method-heading">
          <a href="#M000024" class="method-signature">
          <span class="method-name">warn_deprecation</span><span class="method-args">(deprecated_method, new_method)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000024-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec-rails/lib/spec/rails/example/render_observer.rb, line 29</span>
29:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">warn_deprecation</span>(<span class="ruby-identifier">deprecated_method</span>, <span class="ruby-identifier">new_method</span>)
30:           <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">warn</span> <span class="ruby-value str">&quot;\#{deprecated_method} is deprecated and will be removed from a future version of rspec-rails.\n\nPlease just use object.\#{new_method} instead.\n&quot;</span>
31:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>